package nc.impl.arap.bx;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import nc.bs.arap.bx.BXZbBO;
import nc.bs.arap.outer.ArapPubDelInterface;
import nc.vo.arap.bx.util.BXConstans;
import nc.vo.ep.bx.BXHeaderVO;
import nc.vo.ep.bx.BXVO;
import nc.vo.ep.bx.JsConstrasVO;
import nc.vo.ep.dj.DJZBVO;

/**
 * @author twei
 *
 * nc.impl.arap.bx.ArapBxJsDelEffImp
 * 
 */
public class ArapBxJsDelEffImp implements ArapPubDelInterface{

	public DJZBVO afterDelAct(DJZBVO param) throws Exception {
		BXZbBO bo =new BXZbBO();
		Collection<JsConstrasVO> vos = bo.queryJsContrastsByJsd(param);
		List<String> keys=new ArrayList<String>();
		
		for(JsConstrasVO vo:vos){
			keys.add(vo.getPk_bxd());
		}

		List<BXHeaderVO> bxds = bo.queryHeadersByPrimaryKeys(keys.toArray(new String[]{}), BXConstans.BX_DJDL);
		
		List<BXVO> allBxds=new ArrayList<BXVO>();
		for (BXHeaderVO vo:bxds) {
			allBxds.add(new BXVO(vo));
		}
		
		bo.unSettleFromArap(allBxds.toArray(new BXVO[]{}));
		
		return param;
	}

	public DJZBVO beforeDelAct(DJZBVO param) throws Exception {
		return null;
	}

}
